import java.util.Scanner;

class Recta{
    double longth;
    double width;
    double GetC()
    {
        return 2*(width+longth);
    }
    double GetS()
    {
        return width*longth;
    }
}

class Circle{
    double r;
    double pi=3.14;
    double GetC()
    {
        return 2*pi*r;
    }
    double GetS()
    {
        return pi*r*r;
    }
}

class Cubiod{
    double a,b,c;
    double GetV()
    {
        return a*b*c;
    }
}

public class start {
    public static void main(String[] args){

        Recta a=new Recta();
        Circle b=new Circle();
        Cubiod c=new Cubiod();

        System.out.println("选择形状（1.矩形  2.圆形）:");
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        switch (n)
        {
            case 1:
                System.out.println("输入长和宽：");
                sc=new Scanner(System.in);
                a.longth=sc.nextDouble();
                a.width=sc.nextDouble();
                System.out.println("周长："+a.GetC()+"面积："+a.GetS());
                break;
            case 2:
                System.out.println("输入半径：");
                sc=new Scanner(System.in);
                b.r=sc.nextDouble();
                System.out.println("周长："+b.GetC()+"面积："+b.GetS());
                break;
            default:
                System.out.println("输入错误！");

        }
        sc.close();
    }
}